package LeetcodeTest_forty_two;
//283. 移动零
public class moveZeroes
{
    public static void main(String[] args)
    {
        int[] nums={0,1,0,3,12,4};
        Solution.moveZeroes(nums);
    }
}
class Solution
{
    public static void moveZeroes(int[] nums)
    {
        int i,j,temp;
        for(i=0;i<nums.length-1;i++)
        {
            if(nums[i]==0)
            {
                for(j=i+1;j<nums.length;j++)
                {
                    if(nums[j]!=0)
                    {
                        temp=nums[i];
                        nums[i]=nums[j];
                        nums[j]=temp;
                        break;
                    }
                }
            }
        }
        for(int k:nums)
            System.out.print(k+"  ");
    }
}